package com.rx.core.anno;

import com.rx.core.base.RxBaseConstant;
import com.rx.core.data.RxDataScan;
import com.rx.core.handler.RxHandlerScan;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;

/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @version V1.0
 * @Title: RxSpringBootApplication
 * @Package com.rx.core.anno
 * @Description: 启动注解
 * @author: 陈锦韬
 * @date: 2020\9\11 0011
 * @Copyright: 2020 陈锦韬  All rights reserved.
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootApplication
// 远程调用
@EnableFeignClients
// 服务降级
@EnableCircuitBreaker
@MapperScan
// 数据流
@RxDataScan
// 自定义处理器
@RxHandlerScan
@ComponentScan
public @interface RxSpringBootApplication {

    @AliasFor(annotation = EnableFeignClients.class,attribute="basePackages")
    String[] feignClientsPackages() default {RxBaseConstant.DEFALUT_PKG_SERVICE};

    @AliasFor(annotation = MapperScan.class,attribute="basePackages")
    String[] mapperPackages() default {RxBaseConstant.DEFALUT_PKG_DAO};

    // 这个属性是为RxDataScan设置的
    @AliasFor(annotation = RxDataScan.class,attribute="value")
    String[] dataPackages() default {RxBaseConstant.DEFALUT_PKG_DATA};

    // 这个属性是为RxDataScan设置的
    @AliasFor(annotation = RxHandlerScan.class,attribute="value")
    String[] handlerPackages() default {RxBaseConstant.DEFALUT_PKG_HANDLER};

    @AliasFor(annotation = ComponentScan.class,attribute="basePackages")
    String[] componentPackages() default {RxBaseConstant.DEFALUT_PKG_CORE};
}
